package com.intermancer.predictor.lifecycle;

import com.intermancer.predictor.select.SelectStrategy;
import com.intermancer.predictor.store.StoreEntryDAO;

public class SelectCommand extends LifecycleCommandBase {
	
	private SelectStrategy selectStrategy;
	private StoreEntryDAO storeEntryDAO;
	
	public SelectCommand() {
		// Nothing.
	}
	
	public SelectCommand(SelectStrategy selectStrategy, StoreEntryDAO storeEntryDAO) {
		this.selectStrategy = selectStrategy;
		this.storeEntryDAO = storeEntryDAO;
	}

	@Override
	boolean innerExecute(LifecycleContext context) {
		context.setParents(selectStrategy.choose(storeEntryDAO));
		return false;
	}

	public void setSelectStrategy(SelectStrategy selectStrategy) {
		this.selectStrategy = selectStrategy;
	}

	public void setStoreEntryDAO(StoreEntryDAO dao) {
		this.storeEntryDAO = dao;
	}

}
